<template>
  <div class="container-fluid">
    <div class="row">
      <div class="col">
        <el-table height="100%" :data="getwechattemp" style="width: 100%">
          <el-table-column label="Name" prop="name" width="200"></el-table-column>
          <el-table-column>
            <template slot-scope="scope">
              <code v-text="fuz(scope.row)"></code>
            </template>
          </el-table-column>
        </el-table>
      </div>
    </div>
  </div>
</template>

<script>
import { mapGetters } from "vuex";
import { wechatsignature } from "../../../plugins/api.js";
export default {
  name: "wechattemp",
  computed: mapGetters(["getwechattemp"]),
  data() {
    return {
      search: "",
      name: "视频库",
      paths: [
        {
          name: "微信",
          path: "/wechat"
        }
      ],
      wexin: {}
    };
  },
  async mounted() {
    this.wexin = await wechatsignature();
  },
  methods: {
    fuz(v) {
      const href = window.location.origin;
      const redirect_uri = encodeURIComponent(`${href}/wechat/redirect_uri`);
      const appid = this.wexin.appID;
      return `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${appid}&redirect_uri=${redirect_uri}&response_type=code&scope=snsapi_userinfo&state=${
        v.ID
      }#wechat_redirect`;
    }
  }
};
</script>
